a11y: Don't use an idle handler for entry actions
authorBenjamin Otte <otte@redhat.com>
Tue, 5 Jul 2011 12:30:49 +0000 (14:30 +0200)
committerBenjamin Otte <otte@redhat.com>
Wed, 6 Jul 2011 14:40:04 +0000 (16:40 +0200)
gtk/a11y/gtkentryaccessible.c
gtk/a11y/gtkentryaccessible.h

index ff8de78029f1d92eb594f20ddb08ae39232a440a..7e2133981c6f36848e8f1b9344eb18151cfad8b6 100644 (file)
@@ -51,19 +51,6 @@ G_DEFINE_TYPE_WITH_CODE (GtkEntryAccessible, gtk_entry_accessible, GTK_TYPE_WIDG
                          G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init))
 
 
-static void
-gtk_entry_accessible_finalize (GObject *object)
-{
-  GtkEntryAccessible *entry = GTK_ENTRY_ACCESSIBLE (object);
-
-  if (entry->action_idle_handler)
-    {
-      g_source_remove (entry->action_idle_handler);
-      entry->action_idle_handler = 0;
-    }
-  G_OBJECT_CLASS (gtk_entry_accessible_parent_class)->finalize (object);
-}
-
 static AtkStateSet*
 gtk_entry_accessible_ref_state_set (AtkObject *accessible)
 {
@@ -207,12 +194,9 @@ gtk_entry_accessible_get_index_in_parent (AtkObject *accessible)
 static void
 gtk_entry_accessible_class_init (GtkEntryAccessibleClass *klass)
 {
-  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   AtkObjectClass  *class = ATK_OBJECT_CLASS (klass);
   GtkWidgetAccessibleClass *widget_class = (GtkWidgetAccessibleClass*)klass;
 
-  gobject_class->finalize = gtk_entry_accessible_finalize;
-
   class->ref_state_set = gtk_entry_accessible_ref_state_set;
   class->get_index_in_parent = gtk_entry_accessible_get_index_in_parent;
   class->initialize = gtk_entry_accessible_initialize;
@@ -970,32 +954,12 @@ check_for_selection_change (GtkEntryAccessible *accessible,
   return ret_val;
 }
 
-static gboolean
-idle_do_action (gpointer data)
-{
-  GtkEntryAccessible *entry;
-  GtkWidget *widget;
-
-  entry = GTK_ENTRY_ACCESSIBLE (data);
-  entry->action_idle_handler = 0;
-  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (entry));
-  if (widget == NULL /* State is defunct */ ||
-      !gtk_widget_get_sensitive (widget) || !gtk_widget_get_visible (widget))
-    return FALSE;
-
-  gtk_widget_activate (widget);
-
-  return FALSE;
-}
-
 static gboolean
 gtk_entry_accessible_do_action (AtkAction *action,
                                 gint       i)
 {
-  GtkEntryAccessible *entry;
   GtkWidget *widget;
 
-  entry = GTK_ENTRY_ACCESSIBLE (action);
   widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action));
   if (widget == NULL)
     return FALSE;
@@ -1006,10 +970,7 @@ gtk_entry_accessible_do_action (AtkAction *action,
   if (i != 0)
     return FALSE;
 
-  if (entry->action_idle_handler)
-    return FALSE;
-
-  entry->action_idle_handler = gdk_threads_add_idle (idle_do_action, entry);
+  gtk_widget_activate (widget);
 
   return TRUE;
 }
index a3d2354cdb85ef830f3bc14656f5aa4ca3521de6..9b9c3c2201783f232d3d4cc5475c2dee4c1d392f 100644 (file)
@@ -44,8 +44,6 @@ struct _GtkEntryAccessible
   gint length_delete;
   gint cursor_position;
   gint selection_bound;
-
-  guint action_idle_handler;
 };
 
 struct _GtkEntryAccessibleClass